import Vuex from 'vuex'

let store = () => new Vuex.store({
    state: {
        token: ''
    },
    mutations: {
        setToken (state, token) {
          state.token = token
        }
    },
    actions: {
        nuxtServerInit({ commit}, { req }) {
            let cookie = req.headers.cookie
            commit('setToken ', cookie.token)
        }
    }
})
export default store